import { createRouter, createWebHistory } from 'vue-router'

export const menu_router = [
  {
    path: '/',
    meta: {
      title: '首页'
    },
    component: () => import('@/views/home/indexView.vue')
  },
  {
    path: '/trash',
    meta: {
      title: '回收站'
    },
    component: () => import('@/views/trash/indexView.vue')
  },
  {
    path: '/mange',
    meta: {
      title: '列表管理'
    },
    children: [
      {
        path: '/mange/list',
        meta: {
          title: '列表'
        },
        component: () => import('@/views/list/indexView.vue')
      },
      {
        path: '/mange/listAdd',
        meta: {
          title: '新增'
        },
        component: () => import('@/views/listAdd/indexView.vue')
      },
    ]
  },
  // {
  //   path: '/404',
  //   name: '404',
  //   component: () => import('@/views/404/indexView.vue')
  // },
  // {
  //   path: '/:pathMatch(.*)*',
  //   redirect: '/404'
  // },
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: () => import('@/views/layout/indexView.vue'),
      children: menu_router
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/indexView.vue')
    }
  ]
})

export default router
